using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Elementum
{
    class AlphaModifier:Modifier
    {
        float _alpha;
        float _startAlpha;
        float _endAlpha;

        public AlphaModifier(float startAlpha,float endAlpha,int start, int end) : base(start, end) {
            _startAlpha = startAlpha;
            _endAlpha = endAlpha;
            _alpha = (_endAlpha - _startAlpha) /(end - start);

        }

        protected override void ModifyDone()
        {
            _registor.Alpha = _endAlpha;
            base.ModifyDone();   
        }

        protected override void OnModify()
        {
            if (_counter == _start)
            {
                _registor.Alpha = _startAlpha;
                foreach (VisibleObject c in _registor._children)
                {
                    c.Alpha = _startAlpha;
                }
            }
            _registor.Alpha += _alpha;

            foreach (VisibleObject c in _registor._children) {
                c.Alpha += _alpha;
            }

        }
    }
}
